package com.dh.blog.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.groups.ConvertGroup;

import org.hibernate.validator.constraints.NotBlank;

import com.ewei.web.common.validator.CascadeGroup;
import com.ewei.web.common.validator.SaveGroup;
import com.ewei.web.common.validator.UpdateGroup;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

@JsonInclude(Include.NON_EMPTY)
public class ArticleVo implements Serializable{
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 4335349901132713022L;
	private Integer id;
	/**
	 * 文章标题
	 */
	@NotBlank(message="{title.not.null}",groups={UpdateGroup.class,SaveGroup.class})
	private String title;
	/**
	 * 文章描述
	 */
	@NotNull(message="{description.not.null}",groups={UpdateGroup.class,SaveGroup.class})
	private String description;
	/**
	 * 文章html内容（不直接存在数据库）
	 */
	@NotNull(message="{content.not.null}",groups={UpdateGroup.class})
	private String content;
	/**
	 * 文章的markdown语言（做文章的草稿文件）
	 */
	@NotNull(message="{md.not.null}",groups={UpdateGroup.class})
	private String md;
	/**
	 * 文章内容文件路径
	 */
	@JsonIgnore
	private String diskpath;
	/**
	 * 阅读量
	 */
	private int readers;
	/**
	 * 评论数
	 */
	private int comments;
	/**
	 * 是否可见(0:否,1:是)
	 */
	private int visiable;
	/**
	 * 是否发布(0:否,1:是)
	 */
	private int irelease;
	/**
	 * 是否推荐(0:否,1:是)
	 */
	private int icommand;
	/**
	 * 文章类型(0:原创)
	 */
	private int type;
	/**
	 * 发布时间
	 */
	private Date releaseTime;
	/**
	 * 创建时间
	 */
	private Date createTime;
	/**
	 * 更新时间，处理并发
	 */
//	@JsonIgnore
	private long updateTime;
	/**
	 * 归档,考虑暂时不做映射
	 */
	@JsonIgnore
	private Integer holdId;
	/**
	 * 博客对象
	 */
//	@JsonIgnore
	private BlogVo blog;
	/**
	 * 类别对象
	 */
	@Valid
	@ConvertGroup(from=SaveGroup.class,to=CascadeGroup.class)
	private ClassifyVo classify;
	/**
	 * 图片
	 */
	private List<PictureFileVo> pics = new ArrayList<PictureFileVo>();
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getDiskpath() {
		return diskpath;
	}
	@JsonIgnore
	public void setDiskpath(String diskpath) {
		this.diskpath = diskpath;
	}
	public int getComments() {
		return comments;
	}
	public void setComments(int comments) {
		this.comments = comments;
	}
	public int getVisiable() {
		return visiable;
	}
	public void setVisiable(int visiable) {
		this.visiable = visiable;
	}
	public Date getReleaseTime() {
		return releaseTime;
	}
	public void setReleaseTime(Date releaseTime) {
		this.releaseTime = releaseTime;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public long getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(long updateTime) {
		this.updateTime = updateTime;
	}
	public Integer getHoldId() {
		return holdId;
	}
	public void setHoldId(Integer holdId) {
		this.holdId = holdId;
	}
	public BlogVo getBlog() {
		return blog;
	}
	public void setBlog(BlogVo blog) {
		this.blog = blog;
	}
	public ClassifyVo getClassify() {
		return classify;
	}
	public void setClassify(ClassifyVo classify) {
		this.classify = classify;
	}
	
	public int getIrelease() {
		return irelease;
	}
	public void setIrelease(int irelease) {
		this.irelease = irelease;
	}
	public int getIcommand() {
		return icommand;
	}
	public void setIcommand(int icommand) {
		this.icommand = icommand;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getReaders() {
		return readers;
	}
	public void setReaders(int readers) {
		this.readers = readers;
	}
	public List<PictureFileVo> getPics() {
		return pics;
	}
	public void setPics(List<PictureFileVo> pics) {
		this.pics = pics;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getMd() {
		return md;
	}
	public void setMd(String md) {
		this.md = md;
	}
	
}
